// Programming_Scala/src/ch13/bank-account.scala

class BankAccount( val balance: Double ) {
  require( balance >= 0 )

  def debit( amount: Double ) = {
    require( amount >= 0, "The debit amount must be > 0.00" )
    assume( balance - amount > 0.0, "Overdrafts are not permitted" )
    new BankAccout( balance - amount )
  }

  def crebit( amount: Double ) = {
    require( amount >= 0, "The credit amount must be > 0.00" )
    new BankAccout( balance + amount )
  }
}
